#pragma once

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

namespace TestDX
{

class Input;
class Graphix;

class WinSystem
{
public:
	WinSystem();
	~WinSystem();

	bool Init();
	void Shutdown();

	//< Runs the main loop
	void Run();

	//< Message handler for the application
	LRESULT CALLBACK MsgHandler(
		HWND hwnd,
		UINT umsg,
		WPARAM wparam,
		LPARAM lparam);

private:
	// Copy and assign are forbidden
	WinSystem(const WinSystem &);
	WinSystem & operator=(const WinSystem &);

	//< Initialize main window, create and show it
	void InitWinApi(int & width, int & height);

	//< Shuts down main window
	void ShutdownWinApi();

	// Frame processing
	bool Frame();

	// ATTRIBS
	LPCWSTR _appName;
	HINSTANCE _hInstance;
	HWND _hWnd;

	// The chicha of the thing!
	TestDX::Input *_pInput;
	Graphix *_pGraphics;

	// Constants
	static const int SCREEN_WIDTH;
	static const int SCREEN_HEIGHT;
};

// Globals:
//< Window message handling
static LRESULT CALLBACK WndProc(
	HWND hwnd,
	UINT umsg,
	WPARAM wparam,
	LPARAM lparam);

// Pointer to WinSystem object (needed by WndProc)
static WinSystem * __pApp = NULL;

}